package org.lion.bean;

import org.lion.proxy.output.student.StudentLoginResponse;

import java.util.List;

/**
 * Created by lion on 3/17/17.
 */
public class LoginInfo {
    private StudentLoginResponse response;
    private String sessionId;
    private String csrftoken;
    public StudentLoginResponse getResponse() {
        return response;
    }

    public void setResponse(StudentLoginResponse response) {
        this.response = response;
    }

    public String getSessionId() {
        return sessionId;
    }

    public void setSessionId(String sessionId) {
        this.sessionId = sessionId;
    }

    public String getCsrftoken() {
        return csrftoken;
    }

    public void setCsrftoken(String csrftoken) {
        this.csrftoken = csrftoken;
    }

    public void store(List<String> list) {
        if (list == null) {
            return;
        }
        for (String s : list) {
            if (s.startsWith("csrftoken")) {
                setCsrftoken(s.substring("csrftoken".length()+1));
            }

            if (s.startsWith("sessionid")) {
                setSessionId(s.substring("sessionid".length()+1));
            }

        }
    }
}
